In three dimensional graphics, surfaces are typically rendered by assembling a plurality of polygons in a desired shape. The polygons (which are typically triangles) are defined by vertices, and each vertex is defined by three dimensional coordinates in world space, by color values, and by texture coordinates.
The surface determined by an assembly of polygons is typically intended to be viewed in perspective. To display the surface on a computer monitor, the three dimensional world space coordinates of the vertices are transformed into screen coordinates in which horizontal and vertical values (x, y) define screen position and a depth value z determines how near a vertex is to the screen and thus whether that vertex is viewed with respect to other points at the same screen coordinates. The color values define the brightness of each of red/green/blue (r, g, b) color at each vertex and thus the color (often called diffuse color) at each vertex. Texture coordinates (u, v) define texture map coordinates for each vertex on a particular texture map defined by values stored in memory.
The world space coordinates for the vertices of each polygon are processed to determine the two-dimensional coordinates at which those vertices are to appear on the two-dimensional screen space of an output display. If a triangle's vertices are known in screen space, the positions of all pixels of the triangle vary linearly along scan lines within the triangle in screen space and can thus be determined. Typically, a rasterizer uses (or a vertex processor and a rasterizer use) the three-dimensional world coordinates of the vertices of each polygon to determine the position of each pixel of each surface (“primitive” surface”) bounded by one of the polygons.
The color values of each pixel of a primitive surface (sometimes referred to as a “primitive”) vary linearly along lines through the primitive in world space. A rasterizer performs (or a rasterizer and a vertex processor perform) processes based on linear interpolation of pixel values in screen space, linear interpolation of depth and color values in world space, and perspective transformation between the two spaces to provide pixel coordinates and color values for each pixel of each primitive. The end result of this is that the rasterizer outputs a sequence red/green/blue color values (conventionally referred to as diffuse color values) for each pixel of each primitive.
One or more of the vertex processor, the rasterizer, and a texture processor compute texture coordinates for each pixel of each primitive. The texture coordinates of each pixel of a primitive vary linearly along lines through the primitive in world space. Thus, texture coordinates of a pixel at any position in the primitive can be determined in world space (from the texture coordinates of the vertices) by a process of perspective transformation, and the texture coordinates of each pixel to be displayed on the display screen can be determined. A texture processor can use the texture coordinates (of each pixel to be displayed on the display screen) to index into a corresponding texture map to determine texels (texture color values at the position defined by the texture coordinates for each pixel) to vary the diffuse color values for the pixel. Often the texture processor interpolates texels at a number of positions surrounding the texture coordinates of a pixel to determine a texture value for the pixel. The end result of this is that the texture processor generates data determining a textured version of each pixel (of each primitive) to be displayed on the display screen.
Typical graphics processors used in computer graphics systems produce 32-bit words of video data (“pixels”). Each word comprises four 8-bit color component words (e.g., a red, green, blue, and alpha component). Typical display devices display 24-bit pixels (each pixel comprising three 8-bit color components, e.g., red, green, and blue components) determined by a stream of such 32-bit video data words. However, some display devices (e.g., some flat panel displays) are configured to display 18-bit pixels, each comprising three 6-bit color component words. More generally, some display devices (e.g., some flat panel displays) are configured to display M-bit pixels (where M=3N, and N<8), each pixel comprising three N-bit color component words. In order to generate video data for display on an 18-bit display device, a graphics processor that generates 32-bit pixels can operate in a mode in which the two least significant bits of each 8-bit green component, 8-bit red component, and 8-bit blue component determined by the 32-bit pixels are truncated to generate 18-bit output pixels (each comprising three 6-bit color components) which are provided to the display device.
However, undesired visible artifacts (such as banding) can result from such truncation of video data. In order to reduce such artifacts, some conventional graphics processors employ spatial dithering. Spatial dithering introduces noise to the least significant bit (or bits) of the displayed pixels by applying specially-chosen dither bits to blocks of color component words. For example, visible banding can result when Y-bit pixels of a frame of input video data (indicative of a continuously decreasing color across a region) are truncated to X-bit pixels (where X<Y) to produce a frame of X-bit output data and the frame of X-bit output data is displayed (due to sudden transitions across the region in the values of the least significant bits of the displayed output words). Spatial dithering can add noise to the least significant bits of the output words to prevent such banding. However, when a purely spatial dither pattern is applied (so that the dither pattern does not vary from frame to frame) the pattern can be very visible, especially if the display bit depth is low (e.g., when displaying 12-bit pixels, each comprising three 4-bit components).
Temporal dithering attempts to make dither pattern application invisible by varying the applied pattern from frame to frame. When employing temporal dithering, the noise (dither pattern sequence) added to a sequence of frames should have a time average substantially equal to zero, in the following sense. If the undithered data is a stream of identical pixels, the pixels of each frame of the dithered data will not all be identical, but the time average (over many frames of the dithered data) of the color displayed at each pixel location on the display screen should not differ significantly from the color of the displayed undithered data.
However, depending on the algorithm used to vary an applied dither pattern from frame to frame, temporal dithering cause the undesirable visible artifact known as “flicker.” Flicker results when dithering produces a sequence of pixels that are displayed at the same location on a display screen with periodically varying intensity, especially where the frequency at which the intensity varies is in a range to which the eye is very sensitive. The human eye is very sensitive to flicker that occurs at about 15 Hz, and more generally is sensitive to flicker in the range from about 4 Hz to 30 Hz (with increasing sensitivity from 4 Hz up to 15 Hz and decreasing sensitivity from 15 Hz up to 30 Hz). If the pixels displayed at the same screen location (with a frame rate of 60 Hz) have a repeating sequence of intensities (within a limited intensity range) that repeats every four frames due to dithering, a viewer will likely perceive annoying 15 Hz flicker, especially where each frame contains a set of identical pixels of this type that are displayed contiguously in a large region of the display screen. However, if the pixels displayed at the same screen location (with a frame rate of 60 Hz) have a repeating sequence of intensities (in the same intensity range) that repeats every sixteen frames, a viewer will be much less likely to perceive as flicker the resulting 3.75 Hz flicker.
It is known to perform temporal dithering in such a manner as to reduce flicker during viewing of the resulting video frames, by applying a repeating sequence of dither bits with a sufficiently long period of repetition. However, until the present invention, temporal dither had not been implemented in a programmable manner that allows the user to vary both spatial and temporal dither parameters and select a parameter set that results in a desired combination of system performance and displayed image quality (e.g., an acceptably small amount of flicker).
Until the present invention, neither a graphics processor nor a display device had been implemented to perform both spatial and temporal dither efficiently in any of multiple user-selectable modes with selectable dither parameters, so that a user can select a mode and parameter set that results in a desired combination of system performance and displayed image quality. Nor, until the present invention, had a system had been implemented to include such a programmable graphics processor or display device that is operable in at least one mode in which pixels of a first length (e.g., 24-bit pixels) are displayed, and at least two other modes in which temporally and spatially dithered pixels of a shorter length (e.g., 18-bit pixels) are displayed (e.g., on a flat panel device capable only of displaying pixels having 18-bit maximum length). Nor, until the present invention, had such a system been implemented to be allow user selection of kernel size during spatial dithering, or to allow application of long dither sequences (having selected period) while minimizing the amount of memory required to store the dither bits to be applied.